<template>
	<view class='page'>
		<c-nav-bar :title="titleHeader" ></c-nav-bar>
		<view class="header">
			{{contentList.title}}
		</view>
		<view class="time">
			{{contentList.releaseTime}}
		</view>
		<view class="content">
			<!-- {{contentList.content}} -->
			<u-parse :content="contentList.content" @preview="preview" @navigate="navigate" noData="正在加载中..." />
		</view>
	</view>
</template>

<script>
	// import uParse from '@/components/u-parse/u-parse.vue'
	export default {
		// components: {
		// 	uParse //注册组件
		// },
		data() {
			return {
				titleHeader:'公告详情',
				noticeId: '',
				contentList: {}
			}
		},
		onLoad(option) {
			console.log(option, 'option');
			this.noticeId = option.noticeId
			this.getNoticeDetail()
		},
		methods: {
			preview(src, e) { //事件：点击富文本里的图片
				// do something
			},
			navigate(href, e) { //事件：点击富文本里的链接
				// do something
			},
			get() {},

			getNoticeDetail() {
				this.$api.get('/api/notice/noticeGetOne', {
					id: this.noticeId
				}).then(res => {
					if (res.data.code == 0) {
						this.contentList = res.data.data
						console.log(res, '333333');
					} else {
						uni.showToast({
							title: res.data.msg
						})

					}
				})
			}
		}
	}
</script>

<style lang="scss">
	@import url("/components/u-parse/u-parse.css");

	/deep/ .wxParse {
		margin: 10px auto;
		width: 90vw;
		padding: 20px 10px;
		box-sizing: border-box;
		border-radius: 10px;
		border: 1px solid #E0E0E0;
		box-shadow: 2px 2px 10px #7d7d7d;
	}

	/deep/ .first {
		text-align: center;
		padding-bottom: 5px;
		border-bottom: 1px solid #E0E0E0;
	}

	.page {
		padding: 20rpx;
		padding-top: 130rpx;

		.header {
			margin: 20rpx 0 20rpx;
			font-size: 34rpx;
		}

		.time {
			width: 100%;
			font-size: 24rpx;
			color: #999999;
		}

		.content {
			margin-top: 40rpx;
			font-size: 30rpx;
			color: #111111;

		}
	}
</style>